<?php

class NodeController extends AppController {

    var $name = 'Node';
    var $uses = array('static_pages.StaticPage');
    var $view = 'Theme';
    var $theme = 'qat';
    var $helpers = array('text');

    //var $layout = 'home';
    function index() {
        // Load Galleries

        $about_us = ClassRegistry::init('static_pages.StaticPage')->find('first', array(
            'conditions' => array(
                'StaticPage.alias' => 've-qat-group',
                'is_published' => 1,
            ),
            'fields' => array('title', 'content' , 'description')
                //'contain'		=> array()
                ));
        
        $this->set(compact('about_us'));
    }
    
    function view($alias = null) {
	    if($alias != null){
    		$detail = $this->StaticPage->find('first', array(
    			'conditions'	=>	array(
    				"StaticPage.alias" => $alias,
                    "is_published"   => 1
    			),
    			'fields'		=>	array('title', 'alias', 'content')
    		));
        }else{
    		$detail = $this->StaticPage->find('first', array(
    			'conditions'	=>	array(
                    "is_published"   => 1
    			),
    			'fields'		=>	array('title', 'alias', 'content')
    		));
        }
		$others = $this->StaticPage->find('all', array(
			'conditions'	=>	array(
				"StaticPage.alias <>" => $detail["StaticPage"]["alias"],
                "is_published"   => 1
			),
			'fields'		=>	array('title', 'alias', 'content')
		));
		$this->set(compact('detail', 'others'));
	}

}

?>